<?php

use App\Models\CustomerUser;
use LTools\Libraries\RedisUnique;

/**
 * 是否客户后台的请求
 * @return bool
 * @author luffyzhao@vip.126.com
 */
function is_customer(): bool
{
    return auth()->user() instanceof CustomerUser;
}


/**
 * @param string $key
 * @param int $length
 * @param int $toBase
 * @return string
 * @throws Exception
 * @author luffyzhao@vip.126.com
 */
function unique_code(string $key, int $length, int $toBase = 36): string
{
    return RedisUnique::getInstance()->generate($key, $length, $toBase);
}
